<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Service_model extends CI_Model{
	function __construct() {
		parent::__construct();
	}
	
	function add_service($clause){
		$this->db->insert('service',$clause);
//                die($this->db->last_query());
		return $this->db->insert_id();
	}
	
	function update_service($data){
		$id = $data['id'];
		unset ($data['id']);
		$this->db->where('id',$id);
		$this->db->update('service',$data);
	}
	
	function get_service($id){
		$query = $this->db->get_where('service',array('id'=>$id));
		if($query->num_rows>0){
			return $query->row_array();
		}else{
			return FALSE;
		}
	}
	
	function get_all_service(){
		$query = $this->db->get('service');
		return $query->result_array();
	}
        
        function delete_service($id)
        {
            $this->db->delete('service',array('id' => $id));
        }
}

/** End of file */